<?php

namespace app\validate\admin;

use think\Validate;

/**
 * 菜单数验证
 * Class MenuValidate
 * @package app\validate\admin
 */
class MenuValidate extends Validate
{

    public $rule = [
        'id' => 'require',
        'name' => 'require',
        'name_en' => 'require',
        'sort' => 'require|number|between:1,999',
//        'url' => 'require',
    ];

    public $message = [
        'id.require' => '记录id不能为空',
        'name.require' => '菜单名称不能为空',
        'name_en.require' => '标签名称不能为空',
        'url.require' => '跳转地址不能为空',
        'sort.require' => '排序值不能为空',
        'sort.number' => '排序值只能是数字',
        'sort.between' => '排序值应在0~999之间',
    ];

    public $scene = [
        'add' => ['name', 'name_en', 'sort'],
        'update' => ['id', 'name', 'name_en', 'sort'],
    ];
}
